package d2_com.itheima.io;

import java.io.*;

/**
 * 序列化流
 */
public class Test10 {
    public static void main(String[] args) {
        /**
         * Objectoutputstream(对象字节输出流)
         */

        // 创建一个对象字节输出流包装原始的字节 输出流。
        try (ObjectOutputStream ob = new ObjectOutputStream(new FileOutputStream("oop-app6\\13.txt"))) {
            User u = new User("adimin","张三",20,"666");
            //序列化对象成功
            ob.writeObject(u);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
